from my_utils.shell import Shell


class Hive(Shell):
    def e(self, sql):
        sql = sql.format(ymd=self.ymd).replace("'", '"')
        __db = "--database '{}'".format(self.get('hive_db', 'default'))
        return self.sh_cmd_and_alert(f"hive {__db} -e '{sql}'")


if __name__ == '__main__':
    print(Hive().e('SHOW TABLES'))
